import { articleGetChannelListService } from '@/api/article'
import {useEffect, useState} from 'react'

const useTabs = () => {
  const [channels, setChannels] = useState<Api.Article.ChannelItem[]>([])
  useEffect(() => {
    const fetchTabs = async () => {
      try {
        const res = await articleGetChannelListService()
        setChannels(res.data.data.channels)
      }catch(e) {
       throw new Error('fetch channelList failed')
      }
    }
    fetchTabs()
  }, [])
  return {
    channels
  }
}

export {
  useTabs
}